using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sysgeprava.Entities;

namespace Sysgeprava.Repository.Mapping
{
    public class UBIGEOMap : EntityTypeConfiguration<UBIGEO>
    {
        public UBIGEOMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.CodUbigeo)
                .HasMaxLength(6);

            this.Property(t => t.Departamento)
                .HasMaxLength(50);

            this.Property(t => t.Provincia)
                .HasMaxLength(50);

            this.Property(t => t.Distrito)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("UBIGEO");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.CodUbigeo).HasColumnName("CodUbigeo");
            this.Property(t => t.Departamento).HasColumnName("Departamento");
            this.Property(t => t.Provincia).HasColumnName("Provincia");
            this.Property(t => t.Distrito).HasColumnName("Distrito");
        }
    }
}
